
package com.xbongbong.saas.model.impl;

import com.xbongbong.saas.domain.dao.FeedbackDao;
import com.xbongbong.saas.domain.entity.FeedbackEntity;
import com.xbongbong.saas.model.FeedbackModel;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import java.util.Objects;


@Service("feedbackModel")
public class FeedbackModelImpl implements FeedbackModel {

	@Resource
	private FeedbackDao feedbackDao;

	@Override
	public Integer insert(FeedbackEntity entity){
		entity.setId(null);
		return feedbackDao.insert(entity);
	}

	@Override
	public Integer update(FeedbackEntity entity){
		return feedbackDao.update(entity);
	}

	@Override
	public Integer save(FeedbackEntity entity){
		if(entity.getId() == null || Objects.equals(0, entity.getId())) {
			entity.setId(null);
			return feedbackDao.insert(entity);
		}
		return feedbackDao.update(entity);
	}

	@Override
	public List<FeedbackEntity> findEntitys(Map<String ,Object>  param){
		return feedbackDao.findEntitys(param);
	}

	@Override
	public Integer getEntitysCount(Map<String ,Object>  param){
		return feedbackDao.getEntitysCount(param);
	}

    @Override
    public List findEntitysWithoutSub(Map<String, Object> param) {
        return null;
    }


    @Override
	public FeedbackEntity getByKey(Integer key) {
		return feedbackDao.getByKey(key);
	}


	@Override
	public Integer deleteByKey(Integer key) {
		return feedbackDao.deleteByKey(key);
	}


}

